package edu.nf.ch06.superfactory;

import edu.nf.ch06.product.Phone;

/**
 * @author wangl
 * @date 2025/4/15
 */
public class SuperFactory {

    public static <T> T create(String className) {
        try {
            Object instance = Class.forName(className)
                    .getConstructor()
                    .newInstance();
            return (T) instance;
        } catch (Exception e) {
            throw new RuntimeException("Object instantiation failed.", e);
        }
    }
}